package org.example.demo;

/**
 * @author zxiaoming
 * @Description:在不创建someService对应实现类的情况下，调用该实现类中对应方法
 * @date 2021/2/2421:02
 */
public class ServiceBean {
    private SomeService someService;
    private String name;

    public void setName(String name) {
        this.name = name;
    }

    public ServiceBean(SomeService someService,String name) {
        System.out.println("ServiceBean中有参构造函数");
        this.someService = someService;
        this.name = name;
    }

    public ServiceBean() {
        System.out.println("ServiceBean中空的构造函数");
    }

    /**
     * 提供属性setter方法
     * @param someService
     */
    public void setSomeService(SomeService someService) {
        this.someService = someService;
    }

    public void helloService(){
        System.out.println("name="+name);
        someService.doSomeThing();
    }
}
